package com.hyny.framework.base.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 是否值
 */
@Getter
@AllArgsConstructor
public enum YesOrNoEnum implements ITagEnumBean {
    YES("1","是",""),
    NO("0","否","");

    @EnumValue
    private  String code;
    private  String msg;
    private  String colour;


    @Override
    public String toString() {

        return this.name()+"-"+this.msg;
    }


    @Override
    public TagEnumBean getEnumBean(){
        TagEnumBean tagEnumBean =new TagEnumBean();
        tagEnumBean.setEStyle(this.colour);
        tagEnumBean.setEValue(this.code);
        tagEnumBean.setEText(this.msg);
        tagEnumBean.setEName(this.name());
        return tagEnumBean;
    }

    /**
     * 获取全部枚举信息
     * @return
     */
    public static List<TagEnumBean> getEnumBeanList() {
        List<TagEnumBean> list=new ArrayList<>();
        for (YesOrNoEnum bean: values()
             ) {
            list.add(bean.getEnumBean());
        }
        return list;
    }
}
